<template>
  <div>
    <div style="background: #e8f1f8">
      <div class="det_tab">
        <div style="text-align: center; margin: 10px">
          {{ form.CheckTaskName }}
        </div>
        <div class="det_tab_item">
          <eagle-cell-group :border="border">
            <eagle-input
              label="检查类型"
              :value="form.CheckTypeName"
              readonly
            ></eagle-input>
            <eagle-input
              label="任务发起人"
              :value="form.CreateChnName"
              readonly
            ></eagle-input>
            <eagle-input
              label="任务发起时间"
              :value="getDateTime(form.CreateDate)"
              readonly
            ></eagle-input>
            <eagle-input
              label="检查时间段"
              rows="1"
              autosize
              type="textarea"
              :value="getDateTime(form.StartDate) + '至' + getDateTime(form.EndDate)"
              readonly
            ></eagle-input>
            <eagle-input
              label="检查要求"
              rows="1"
              autosize
              type="textarea"
              :value="form.CheckRequirement || '暂无检查要求'"
              readonly
            ></eagle-input>
            <eagle-input
              v-if="form.Status == 30"
              label="检查记录"
              :value="
                '隐患：' + form.HiddenDangerCnt + ' /检查：' + form.CheckCnt
              "
              readonly
              islink
              @click="goMyTaskHistoryList('All')"
            ></eagle-input>
            <eagle-input
              v-if="form.Status == 0"
              label="检查记录"
              :value="
                '隐患：' + form.HiddenDangerCnt + ' /检查：' + form.CheckCnt
              "
              readonly
            ></eagle-input>
          </eagle-cell-group>
        </div>
      </div>
      
    </div>
  </div>
</template>

<script>
//检查任务跟踪详情
import { Dialog } from "vant";
import { getDateTime } from "@/utils/getDate";
// import { deepClone } from "@/utils";
export default {
  data() {
    return {
      baseUrl: process.env.VUE_APP_BASE_API,
      id: this.$route.query.id,
      border: false,
      form: {
        
      },
    };
  },
  created() {
    this.geDetail();
  },
  methods: {
    // goMyTaskFileList() {
    //   this.$router.push(
    //     "/Danger/DangerCheckTaskFileList?ctCode=" + this.form.CTCode
    //   );
    // },

    getDateTime(value) {
      return getDateTime(value);
    },
    goMyTaskHistoryList(userName) {
      if (this.form.Status == 0) {
        return;
      } else {
        this.$router.push(
          "/Otherdanger/CheckPlanHistoryList?ctCode=" +
            this.form.CTCode +
            "&userName=" +
            userName
        );
      }
    },

    // 获取详情
    geDetail() {
      let _this = this;
      _this.$axios
      .get("/OtherDangerCheckTaskJG/GetTrackDetail",{params:{ id: _this.id }})
      .then((res)=>{
        _this.form = res.data;
      })
    },

    handleClose() {
      let _this=this;
      Dialog.confirm({
        title: "询问",
        message: "您确定要结束当前检查任务吗?",
      })
        .then(() => {
          // on confirm
          _this.$axios
          .post("/OtherDangerCheckTaskJG/End",{ id: _this.form.ID })
          .then((res)=>{
            _this.$toast.success("结束成功！");
            _this.$router.goRefresh(-1);
          })
        })
        .catch(() => {
          // on cancel
        });
    },
  },
};
</script>

<style lang="less" scoped>
/*
        .main {
            height: 100vh;
        }
    */
.bottom-btns {
  margin-top: 10px;
  padding: 0 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  .submit-btn {
    width: 32%;
    height: 30px;
    font-size: 12px;
  }
  .delete-btn {
    width: 100%;
    height: 30px;
    font-size: 12px;
  }
}
.det_top_box {
  padding: 10px;
  background-color: #e8f1f8;
}

.detail_header {
  color: #ffffff;
  background: url("../../../assets/Images/AppIcon/image_riskunit_detail_bg.png");
  background-size: cover;
  padding: 10px;
  border-radius: 5px;
  /*background-color: #fff;*/

  .det_top {
    display: flex;
    justify-content: space-between;

    .dep_top_img {
      height: 20px;
      width: 20px;
      margin-right: 5px;
    }
  }

  .det_name {
    margin-top: 20px;
    text-align: center;
  }

  .det_location {
    text-align: center;
    margin-bottom: 20px;
  }
}

.det_tab {
  padding: 10px;
  .det_tab_item {
    padding: 10px 0;
    background-color: #fff;
    border-radius: 5px;
    margin-bottom: 10px;

    .det_tab_item_text {
      padding: 0 10px;
    }
  }
}
.text_box {
  padding: 10px;
  border-radius: 5px;
  /*background-color: #e8f1f8;*/
  margin-bottom: 10px;

  .text_top {
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    .top_link {
      color: #1989fa;
    }
  }

  .text_item {
    display: flex;
    justify-content: space-between;
    margin-left: 10px;

    .item_link {
      color: #1989fa;
    }
  }

  .text_img {
    display: flex;
    align-items: center;

    .img_item {
      width: 33.3%;
      text-align: center;

      img {
        height: 25px;
        width: 25px;
        margin-bottom: 10px;
      }
    }
  }

  .text_history {
    display: flex;
    vertical-align: middle;
    margin-bottom: 10px;
  }

  .text_member {
    color: #1989fa;
    margin-bottom: 10px;
  }

  .text_total_img {
    display: flex;
    align-items: center;

    .img_item {
      width: 33.3%;
      text-align: center;

      .img_item_top {
        display: flex;
        vertical-align: middle;
        margin-bottom: 10px;
      }
      img {
        height: 15px;
        width: 15px;
        margin-right: 5px;
      }
    }
  }
  .text_record_list {
    .list_row {
      display: flex;
      justify-content: space-between;
      margin-bottom: 10px;
      > div {
        width: 33.3%;
      }
      .row_center {
        text-align: center;
      }
      .row_right {
        text-align: right;
      }
    }
  }
}
.operate_det {
  background-color: #fff;
  padding: 10px;
  .operate_list {
    font-size: 12px;
    .operate_row_first {
      padding: 10px;
      background-color: #e8f1f8;
      border-bottom: 1px solid #e8f1f8;
      margin-bottom: 10px;
    }
    .operate_row {
      padding: 10px;
      border-bottom: 1px solid #e8f1f8;
      /*margin-bottom: 10px;*/
    }
  }
}
</style>
